package com.example.controller;

import com.example.entity.authority.SystemRole;
import com.example.entity.authority.SystemRoleType;
import com.example.entity.authority.UsedPartyDetail;
import com.example.service.SystemRoleTypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by youkun on 2018/3/19.
 * 角色类型
 */
@RestController
public class SystemRoleTypeController {

    @Autowired
    private SystemRoleTypeService systemRoleTypeService;


    @ApiOperation(value = "查询角色类型详细信息",notes = "查询角色类型详细信息")
    @RequestMapping(value="api/systemRoleType/queryById/{id}",method = RequestMethod.POST)
    Map<String,Object> queryById(@PathVariable(value = "id") String id) {

        return systemRoleTypeService.queryById(id);
    }

    @ApiOperation(value = "添加角色类型详细信息",notes = "添加角色类型详细信息")
    @RequestMapping(value="api/systemRoleType/add",method = RequestMethod.POST)
    Map<String,Object> add(@RequestBody SystemRoleType systemRoleType) {

        return systemRoleTypeService.add(systemRoleType);
    }

    @ApiOperation(value = "修改角色类型详细信息",notes = "修改角色类型详细信息")
    @RequestMapping(value="api/systemRoleType/update",method = RequestMethod.POST)
    Map<String,Object> update(@RequestBody SystemRoleType systemRoleType) {

        return systemRoleTypeService.update(systemRoleType);
    }

    @ApiOperation(value = "删除角色类型详细信息",notes = "删除角色类型详细信息")
    @RequestMapping(value="api/systemRoleType/deleteById/{id}",method = RequestMethod.POST)
    Map<String,Object> deleteById(@PathVariable(value = "id") String id) {

        return systemRoleTypeService.deleteById(id);
    }

    @ApiOperation(value = "查询角色类型列表",notes = "查询角色类型列表")
    @RequestMapping(value="api/systemRoleType/queryList",method = RequestMethod.POST)
    Map<String,Object> queryList(@RequestBody SystemRoleType systemRoleType) {

        return systemRoleTypeService.queryList(systemRoleType);
    }

    @ApiOperation(value = "根据机构类型查询角色类型列表",notes = "根据机构类型查询角色类型列表")
    @RequestMapping(value="api/systemRoleType/queryByPartyType/{id}",method = RequestMethod.POST)
    Map<String,Object> queryListByPartyType(@PathVariable(value = "id") String id) {

        return systemRoleTypeService.queryListByPartyType(id);
    }

    @ApiOperation(value = "根据机构Id查询角色类型列表",notes = "根据机构Id查询角色类型列表")
    @RequestMapping(value="register/queryByPartyId/{id}",method = RequestMethod.POST)
    Map<String,Object> queryByPartyId(@PathVariable(value = "id") String id) {

        return systemRoleTypeService.queryListByPartyId(id);
    }
}
